// pages/payPlan/index.js
const app = getApp();
let globalData = getApp().globalData;
const WxParse = require('../../wxParse/wxParse.js');
const banklist = require('../../utils/banklist.js');
Page({

    /**
     * 页面的初始数据
     */
    data: {
        currentId: '5',
        section: app.globalData.section,
        qian_img: globalData.qian_img,
        visible: false,
        actions: [],
        context1: null,
        helperList: [], //置业顾问列表
        helper_name: '请选择跟办置业顾问',
        hasDraw: false, //默认没有画
        src: null, //签名图片
        step: 0, //初始化  初始步数为0，1 登记信息； 2视频认证； 3支付定金； 4在线选房  5是电子协议，6核对信息
        step4_1: 0, // 0是选房  1是 房源密码  2核对房源 3转让房源
        step5_1: 0,
        name: '',
        tel: '',
        address: '',
        idcard: '', //身份证
        idcard_img: '', //身份证照片
        idcard_back: '', //身份证照片
        helper: {}, // 置业顾问id
        resendTime: 60, //验证码重新发送时间 要与verificationTime保持一致
        verification: '', //验证码
        verificationText: '获取验证码',
        verificationTime: 60,
        sending: false,
        succ_choose: 0, //已选定 
        check_choose: 0, //审核中 
        is_pay_info: {}, //付款未选房客户的信息
        pas: '', //置业顾问给的密码
        group: '', //组团id
        groupList: [],
        building: '', //楼栋id
        buildingList: [],
        unit: '', //单元id
        unitList: [], //单元的数据
        floor: '', //楼层id
        root: '', //房间id
        rootList: [],
        payMoneyData: {},
        roomNum: '', //选中房间编号
        pws: '', // 置业顾问给的密码
        order_dtl: {}, //选房返回确认信息
        agreement: {}, //协议内容
        order_info: {}, //协议返回购房者信息
        payTypeList: [], //支付方式列表
        payType: '请选择付款方式', //选择的支付方式
        visible1: false,
        chooseRoomData: {}, // 审核信息
        chakanxieyi: false,
        deposit: 0, //诚意金
        orderList: [], //订单列表
        modal: false,
        showQrcode: '',
        show_step4_helper: true, // 是否显示第四部选房时置业顾问  false为不显示 true为显示
        front_img: '',
        exchange_status: true,
        check_video: false, // 控制 是否人脸验证  true 验证  false 不验证
        pay_status: false, //控制支付  是否跳过支付  true有支付功能  false 无
        is_zhuan: false, //是否是转让房源  默认 false
        zhuan_index: 0, //点击的是那个下标的转让
        zhuan_modal: false, //转让码显示隐藏
        zhuan_num: '', //  受让页面转让码
        zhuan_tel: '', // 转让人电话
        zhuanrangma: '', // 转让弹窗密码
        bank_card:'',//银行卡号
        bank_name:'',//银行卡开户行
        is_sendBank:false,  //是否发送银行卡验证请求
    },
    handleTap: getApp().globalData.handleTap,
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        // this.setData({
        //     stpe: 2,
        //     tel:globalData.tel
        // })
        if (app.globalData.employId && app.globalData.employId != '') {
            wx.clearStorageSync('videoSrc');
            this.step3();
            this.getHelperList();
            this.getStatus();
            this.getRoomList();
        } else {
            // 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回
            // 所以此处加入 callback 以防止这种情况
            app.employIdCallback = employId => {
                if (employId != '') {
                    wx.clearStorageSync('videoSrc');
                    this.step3();
                    this.getHelperList();
                    this.getStatus();
                    this.getRoomList();
                }
            }
        }

    },
    onShow() {
        // 初始化 画笔
        let videoSrc = wx.getStorageSync('videoSrc');
        if (videoSrc) {
            this.addStep();
        }
    },
    handleTap: getApp().globalData.handleTap,
    onShareAppMessage() {},
    handleOpen() {
        this.setData({
            visible: true
        });
    },
    handleCancel() {
        this.setData({
            visible: false
        });
    },
    handleClickItem({
        detail
    }) {
        const index = detail.index * 1;
        this.setData({
            visible: false,
            helper: this.data.actions[index],
            helper_name: this.data.actions[index].name
        })
    },
    getVideo() {
        wx.navigateTo({
            url: '../../video/index',
        })
    },
    step3() {
        // 签署协议 初始化画笔
        var context1 = wx.createCanvasContext('handWriting1');
        context1.setStrokeStyle("#000000");
        context1.setLineWidth(3);
        this.setData({
            context1: context1,
        })
    },
    touchstart1: function (e) {
        var context1 = this.data.context1;
        context1.moveTo(e.touches[0].x, e.touches[0].y);
        this.setData({
            context1: context1,
            hasDraw: true, //要签字了
        });
    },
    touchmove1: function (e) {
        var x = e.touches[0].x;
        var y = e.touches[0].y;
        var context1 = this.data.context1;
        context1.setLineWidth(3);
        context1.lineTo(x, y);
        context1.stroke();
        context1.setLineCap('round');
        context1.draw(true);
        context1.moveTo(x, y);
    },
    reSign1: function () { //重新画
        var that = this;
        var context1 = that.data.context1;
        context1.draw(); //清空画布
        that.setData({
            hasDraw: false, //没有画
            src: null
        });
    },
    sign1ok: function () {
        var that = this;
        if (!that.data.hasDraw) {
            getApp().globalData.showHint('请签署您的名字');
        } else {
            wx.showLoading({
                mask: true,
            })
            var context1 = that.data.context1;
            context1.draw(true, wx.canvasToTempFilePath({
                canvasId: 'handWriting1',
                success(res) {
                    console.log(res.tempFilePath) //得到了图片下面自己写上传吧
                    that.setData({
                        src: res.tempFilePath
                    })
                    wx.uploadFile({
                        url: globalData.API + 'order/upload',
                        header: {
                            'content-type': 'multipart/form-data'
                        },
                        filePath: res.tempFilePath,
                        name: 'file',
                        formData: {
                            'file': 'test'
                        },
                        success(res) {
                            let data = JSON.parse(res.data)
                            if (data.status == 1) {
                                that.chooseRoom(data.img);
                                that.setData({
                                    src: data.img
                                })
                            }
                        },
                        complete() {
                            wx.hideLoading()
                        },
                        fail() {
                            globalData.showHint('上传失败，重新点击完成签字');
                        }
                    })
                }
            }))
        }
    },
    // 下一步事件
    addStep() {
        let step = this.data.step * 1;
        let _this = this;
        let success = true;
        if (step == 2) {
            this.sendPayInfo();
            return;
        }
        this.setData({
            step: step + 1
        })
    },
    // 获取验证码
    getVerification() {
        let _this = this;
        if (this.data.sending) {
            console.log('正在获取中');
            return false;
        }
        let tel = this.data.is_zhuan && this.data.step == 4 ? this.data.zhuan_tel : this.data.tel;
        if (tel && (/^1(3|4|5|6|7|8|9)\d{9}$/.test(tel))) {
            let time = this.data.verificationTime;
            let data = {
                // mobile: this.data.tel,
                pid:_this.data.pid,
                mobile: tel,
                type: this.data.is_zhuan && this.data.step == 4 ? 'transfer' : 'dg'
            }
            globalData.sendPost('captcha/send', data).then(res => {
                if (res.status == 1) {
                    globalData.showHint(res.message);
                } else {
                    globalData.showHint(res.message);
                }
            })
            let timer = setInterval(function () {
                time--;
                if (time == 0) {
                    clearInterval(timer);
                    _this.setData({
                        verificationText: '获取验证码',
                        verificationTime: _this.data.resendTime,
                        sending: false
                    })
                } else {
                    _this.setData({
                        verificationText: time + 's',
                        verificationTime: time,
                        sending: true
                    })
                }
            }, 1000)
        } else {
            wx.showToast({
                title: '请填写正确电话',
                icon: 'none'
            })
        }
    },
    // input输入事件
    inputChange(event) {
        let key = event.currentTarget.dataset.key;
        let value = event.detail.value;
        this.setData({
            [key]: value
        })
    },
    // 第一步提交校验
    selectStep1() {
        if (!this.data.name) {
            getApp().globalData.showHint('请输入姓名');
            return false;
        }
        if (!this.data.tel || (!/^1[3|5|6|7|8|9]\d{9}$/.test(this.data.tel))) {
            getApp().globalData.showHint('电话错误');
            return false;
        }
        if (!this.data.verification) {
            getApp().globalData.showHint('验证码不能为空');
            return false;
        }
        if (!this.data.address) {
            getApp().globalData.showHint('地址不能为空');
            return false;
        }
        if (!this.data.bank_card) {
            getApp().globalData.showHint('银行卡号不能为空');
            return false;
        }
        if (!this.data.bank_name) {
            getApp().globalData.showHint('银行卡号错误');
            return false;
        }
        if (!this.data.idcard || !/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(this.data.idcard)) {
            getApp().globalData.showHint('身份证号错误');
            return false;
        }
        if (!this.data.idcard_img) {
            getApp().globalData.showHint('身份证正面不能为空');
            return false;
        }
        if (!this.data.idcard_back) {
            getApp().globalData.showHint('身份证反面不能为空');
            return false;
        }
        if (!this.data.helper.id) {
            getApp().globalData.showHint('请选择置业顾问');
            return false;
        }
        let data = {
            pid: globalData.pid,
            captcha: this.data.verification,
            openid: globalData.openid,
            mobile: this.data.tel,
            idcard: this.data.idcard
        }
        globalData.sendPost('order/check-captcha', data).then(res => {
            if (res.status == 1) {
                if (this.data.check_video) {
                    this.setData({
                        step: 2
                    })
                } else {
                    this.sendPayInfo();
                }

            } else {
                globalData.showHint(res.msg);
                return false;
            }
        })
        return true;
    },
    // 上传文件
    eimgcutcb(options) {
        // options包含截图newImg 和图片类型 前后页区别
        let _this = this;
        wx.showLoading({
            title: "上传中",
            mask: true
        })
        wx.uploadFile({
            url: globalData.API + 'order/upload',
            header: {
                'content-type': 'multipart/form-data'
            },
            filePath: options.newImg,
            name: 'file',
            formData: {
                'file': 'test'
            },
            success(res) {
                let data = JSON.parse(res.data)
                if (data.status == 1) {
                    if (options.type == 'qian') {
                        _this.setData({
                            idcard_img: data.img
                        })
                    }
                    if (options.type == 'hou') {
                        _this.setData({
                            idcard_back: data.img
                        })
                    }
                }
            },
            fail(error) {
                console.log(error);
            },
            complete() {
                wx.hideLoading();
            }
        })
    },
    uploadFail(event) {
        let idcard_type = event.currentTarget.dataset.idcard;
        // type 是身份证前后 qian  hou
        let _this = this;
        wx.chooseImage({
            count: 1,
            sizeType: ['compressed'],
            sourceType: ['album', 'camera'],
            success(res) {
                const tempFilePaths = res.tempFilePaths;
                let url = '../../imgCut/index?imgpage=' + res.tempFilePaths[0] + '&wd=360&ht=240&type=' + idcard_type;
                wx.navigateTo({
                    // url: '../../imgCut/index?imgpage=' + res.tempFilePaths[0]
                    url: url,
                    success() {
                        console.log(123)
                    },
                    fail(error) {
                        console.log(error)
                    }
                })
                // _this.eimgcutcb(res.tempFilePaths[0]);
            },
            fail(error) {
                console.log(error)
            },
            complete() {
                console.log(666)
            }
        })
    },
    getHelperList() {
        let data = {
            pid: globalData.pid
        }
        let _this = this;
        globalData.sendPost('project/adviser-list', data).then(res => {
            if (res.status == 1) {
                _this.setData({
                    actions: res.data,
                    helperList: res.data
                })
            } else {
                globalData.showHint(res.msg);
            }
        })
    },
    call(event) {
        let tel = event.currentTarget.dataset.tel;
        wx.makePhoneCall({
            phoneNumber: tel,
        })
    },
    // 提交购买者信息
    sendPayInfo() {
        let data = {
            pid: globalData.pid,
            openid: globalData.openid,
            mobile: this.data.tel,
            name: this.data.name,
            captcha: this.data.verification,
            idcard: this.data.idcard,
            idcard_image: this.data.idcard_img,
            idcard_back: this.data.idcard_back,
            address: this.data.address,
            face: wx.getStorageSync('videoSrc'),
            aid: this.data.helper.id,
            is_transfer: this.data.is_zhuan ? 1 : 0,
            bank_card:this.data.bank_card,
            bank_name:this.data.bank_name
        }
        globalData.sendPost('order/add', data).then(res => {
            if (res.status == 1) {
                let step = this.data.step;
                if (this.data.pay_status) {
                    step = 3
                } else {
                    step = 4;
                    this.setData({
                        show_step4_helper: false
                    })
                }
                this.setData({
                    step4_1: 0,
                    step: step,
                    deposit: res.deposit,
                    ["payMoneyData.trade_no"]: res.ordernum
                })
                wx.clearStorageSync('videoSrc');
                return true;
            } else {
                globalData.showHint(res.msg);
                this.setData({
                    step: 1
                })
                return false;
            }
        })
    },
    //获取信息  是否为付款未选房
    getStatus() {
        let data = {
            openid: globalData.openid,
            pid: globalData.pid, //楼盘id
        }
        let _this = this;
        globalData.sendPost('order/list', data).then(res => {
            if (res.status == 1) {
                if (res.is_pay) {
                    console.log('这里需要添加一个判断，进入是选房还是受让');
                    _this.setData({
                        step: 4,
                        step4_1: res.is_transfer ? 3 : 0,
                        name: res.user.name,
                        tel: res.user.mobile,
                        address: res.user.address,
                        idcard: res.user.idcard,
                        idcard_back: res.user.idcard_back,
                        idcard_img: res.user.idcard_image,
                        ['payMoneyData.trade_no']: res.user.ordernum,
                        chakanxieyi: false,
                        ['helper.id']: res.pay_adviser.id,
                        ['helper.name']: res.pay_adviser.name,
                        ['helper.mobile']: res.pay_adviser.mobile,
                        ['helper.wx_work']: res.pay_adviser.wx_work,
                        ['helper.wx_work_id']: res.pay_adviser.wx_work_id,
                        ['helper.photo']: res.pay_adviser.photo,
                        show_step4_helper: false //false为不显示 true为显示
                    })
                }
                _this.setData({
                    succ_choose: res.success,
                    check_choose: res.check,
                    is_zhuan: res.is_transfer ? true : false,
                    orderList: res.order,
                    front_img: res.front_img,
                    exchange_status: res.exchange_status,
                    check_video: res.check_video,
                    pay_status: res.pay_status
                })
            } else {
                globalData.showHint(res.msg);
                console.log("什么都没有");
            }
        })
    },
    backFang() {
        this.setData({
            step4_1: 0,
            show_step4_helper: false
        })
    },
    // 获取房间信息
    getRoomList(is_first) {
        // is_first 判断是否是第一次进来  不传为第一次  
        let data = {
            pid: globalData.pid,
            group: this.data.group,
            building: this.data.building,
            unit: this.data.unit
        }
        globalData.sendPost('order/room-list', data).then(res => {
            if (res.status == 1) {
                this.setData({
                    groupList: res.groupData,
                    buildingList: res.buildingData,
                    unitList: res.unitData,
                    roomList: res.floorData

                })
                if (!is_first) {
                    this.setData({
                        group: res.groupData[0].group,
                        building: res.buildingData[0].building,
                        unit: res.unitData[0].unit,
                    })
                }
            } else {
                globalData.showHint(res.msg);
            }
        })
    },
    // 房间列表点击事件
    listClick(event) {
        let key = event.currentTarget.dataset.key;
        let id = event.currentTarget.dataset.id;
        let roomNum = event.currentTarget.dataset.roomNum;
        let floor = event.currentTarget.dataset.floor;
        if (key == 'room') {
            if (event.currentTarget.dataset.status == 1) {
                return;
            }
        }
        switch (key) {
            case 'group':
                this.setData({
                    group: id,
                    building: '',
                    unit: '',
                    room: ''
                })
                break;
            case 'building':
                this.setData({
                    building: id,
                    unit: '',
                    room: ''
                })
                break;
            case 'unit':
                this.setData({
                    unit: id,
                    room: ''
                })
                break;
            case 'room':
                this.setData({
                    room: id,
                    roomNum: roomNum,
                    floor: floor
                })
                break;
        }
        this.getRoomList(1);
    },
    // 支付接口
    payMoney() {
        let data = {
            openid: globalData.openid,
            pid: globalData.pid
        }
        let _this = this;
        globalData.sendPost('order/pay', data).then(res => {
            if (res.status == 1) {
                // pay接口返回的数据  存着 不知道有啥用呢
                this.setData({
                    payMoneyData: res
                })
                wx.requestPayment({
                    timeStamp: res.timeStamp,
                    nonceStr: res.nonceStr,
                    package: res.package,
                    signType: res.signType,
                    paySign: res.paySign,
                    success(res) {
                        if (_this.data.is_zhuan) {
                            _this.setData({
                                step: 4,
                                step4_1: 3,
                                show_step4_helper: true //false为不显示 true为显示
                            })
                        } else {
                            _this.setData({
                                step: 4,
                                step4_1: 0,
                                show_step4_helper: false //false为不显示 true为显示
                            })
                        }
                    },
                    fail(error) {
                        console.log(error)
                    }
                })
            } else {
                globalData.showHint(res.msg);
            }
        })
    },
    xuanfang() {
        if (!this.data.group) {
            globalData.showHint('请选择组团');
            return
        } else if (!this.data.building) {
            globalData.showHint('请选择楼栋');
            return
        } else if (!this.data.unit) {
            globalData.showHint('请选择单元');
            return
        } else if (!this.data.room) {
            globalData.showHint('请选择房间');
            return
        } else {
            this.setData({
                step4_1: 1,
                show_step4_helper: true //false为不显示 true为显示
            })
        }
    },
    checkPwd() {
        let data = {
            rid: this.data.room,
            code: this.data.pwd
        }
        if (!this.data.pwd) {
            globalData.showHint('密码不能为空');
            return;
        }
        globalData.sendPost('order/check-code', data).then(res => {
            if (res.status == 1) {
                this.setData({
                    step4_1: 2,
                    show_step4_helper: false
                })
                this.roomDtl();
            } else {
                globalData.showHint(res.msg)
            }
        })
    },
    // 获取户型详情
    roomDtl() {
        let data = {
            openid: globalData.openid,
            pid: globalData.pid,
            rid: this.data.room,
            ordernum: this.data.payMoneyData.trade_no //支付的订单号
        }
        globalData.sendPost('order/detail', data).then(res => {
            if (res.status == 1) {
                this.setData({
                    order_dtl: res
                })
            } else {
                globalData.showHint(res.msg);
            }
        })
    },
    // 前往协议页面
    toXieyi() {
        this.getAgreement()
    },
    // 获取付款协议
    getAgreement() {
        let data = {
            pid: globalData.pid,
            openid: globalData.openid,
            rid: this.data.room,
            ordernum: this.data.payMoneyData.trade_no //支付返回的订单号
        }
        globalData.sendPost('order/agreement', data).then(res => {
            if (res.status == 1) {
                let payTypeList = [];
                if (res.agreement.pay_type.length > 0) {
                    res.agreement.pay_type.map(item => {
                        payTypeList.push({
                            name: item
                        })
                    })
                }
                WxParse.wxParse('article', 'html', res.agreement.party_a, this, 5);
                WxParse.wxParse('article1', 'html', res.agreement.terms, this, 5);
                this.setData({
                    payTypeList: payTypeList,
                    payer_info: res.data,
                    agreement: res.agreement,
                    step: 5,
                    step5_1: 0
                })
            } else {
                globalData.showHint(res.msg);
            }
            wx.hideLoading()
        })
    },
    handleOpen1() {
        this.setData({
            visible1: true
        });
    },
    handleCancel1() {
        this.setData({
            visible1: false
        });
    },
    handleClickItem1({
        detail
    }) {
        const index = detail.index * 1;
        this.setData({
            visible1: false,
            payType: this.data.payTypeList[index].name
        })
    },
    toQianzi() {
        if (this.data.payType !== '请选择付款方式') {
            this.setData({
                step5_1: 1
            })
        } else {
            globalData.showHint('请选择付款方式');
        }
    },
    chooseRoom(qianming) {
        let data = {
            openid: globalData.openid,
            pid: globalData.pid,
            rid: this.data.room,
            signature: qianming,
            ordernum: this.data.payMoneyData.trade_no,
            pay_type: this.data.payType
        }
        wx.showLoading({
            mask: true,
        })
        globalData.sendPost('order/choose-room', data).then(res => {
            if (res.status == 1) {
                wx.hideLoading();
                this.setData({
                    chooseRoomData: res.data
                })
                this.addStep();
            } else {
                globalData.showHint(res.msg);
            }
        })
    },
    lookXieyi() {
        this.setData({
            chakanxieyi: true,
            step: 5,
            step5_1: 0
        })
    },
    btnSuccess(event) {
        let index = event.currentTarget.dataset.idx;
        this.setData({
            modal: true,
            showQrcode: this.data.orderList[index].qrcode
        });
    },
    btnError() {
        globalData.showHint();
    },
    listToXieyi(event) {
        wx.showLoading({
            mask: true,
        })
        let ordernum = event.currentTarget.dataset.ordernum;
        let data = {
            pid: globalData.pid,
            ordernum: ordernum
        }
        globalData.sendPost('order/look-agreement', data).then(res => {
            if (res.status == 1) {
                let payTypeList = [];
                WxParse.wxParse('article', 'html', res.agreement.party_a, this, 5);
                WxParse.wxParse('article1', 'html', res.agreement.terms, this, 5);
                this.setData({
                    payType: res.data.pay_type,
                    src: res.data.signature,
                    payer_info: res.data,
                    agreement: res.agreement,
                    step: 5,
                    step5_1: 0,
                    chakanxieyi: true,
                })
            } else {
                globalData.showHint(res.msg);
            }
            wx.hideLoading();
        })
    },
    backStep0() {
        this.setData({
            step: 0,
            step4_1: 0,
            step5_1: 0,
            chakanxieyi: false,
            helper: {},
        })
        this.getStatus()
    },
    copyWx(event) {
        // let wx = event.currentTarget.dataset.wx_work;
        // wx.setClipboardData({
        //     data: wx,
        //     success(res) {
        //         globalData.showHint('微信号已复制成功');
        //     }
        // })
    },
    startmessage() {
        console.log('请求企业微信')
    },
    completemessage(res) {
        if (res.detail.errcode == "-3002") {
            globalData.showHint('获取插件配置信息失败');
        } else if (res.detail.errcode == "-3004") {
            globalData.showHint('用户信息授权失败');
        } else if (res.detail.errcode == "-3005") {
            globalData.showHint('客服消息发送失败');
        } else if (res.detail.errcode == "-3006") {
            globalData.showHint('当前客服人员与您是好友关系');
        } else if (res.detail.errcode == "-3008") {
            globalData.showHint('当前配置没有客服人员');
        } else {
            globalData.showHint('请查看服务通知的邀请');
        }
    },
    rename() {
        this.setData({
            step: 1,
            is_zhuan: true
        })
    },
    toLoudong() {
        wx.navigateTo({
            url: "../loudong-webview/index",
            fail: function (error) {
                console.lo(error)
            },
            success: function () {
                console.log(666)
            }
        })
    },
    stopPropagation() {},
    getPhoneNumber(e) {
        console.log(globalData.tel);
        if (e.detail.errMsg == "getPhoneNumber:ok") {
            let data = {
                openid: globalData.openid,
                encryptedData: e.detail.encryptedData,
                iv: e.detail.iv,
                pid: globalData.pid
            }
            globalData.sendPost('wxuser/update-wxuser', data).then(res => {
                globalData.tel = res.wxuser.phone;
                wx.makePhoneCall({
                    phoneNumber: res.wxuser.phone,
                })
            })
        } else {
            console.log('没有获取电话权限');
        }
    },
    bindPickerChange(e) {
        const index = e.detail.value;
        this.setData({
            helper: this.data.actions[index],
            helper_name: this.data.actions[index].name
        })
    },
    bindPickerChange1(e) {
        const index = e.detail.value;
        this.setData({
            payType: this.data.payTypeList[index].name
        })
    },
    closeModal() {
        this.setData({
            modal: false
        })
    },
    // 转让房源
    zhuan(event) {
        let code = event.currentTarget.dataset.transferCode;
        console.log(code)
        this.setData({
            zhuanrangma: code,
            zhuan_modal: true
        })
    },
    // 关闭复制 转让码
    closeZhuan() {
        let _this = this;
        // 这里zhuan需要更改为后台传输字段
        wx.setClipboardData({
            data: this.data.zhuanrangma,
            success() {
                _this.setData({
                    zhuan_modal: false
                })
            }
        })
    },
    // 提交转让信息
    zhuanCLick() {
        if (!this.data.zhuan_num) {
            globalData.showHint('转让码不能为空');
            return
        }
        if (!this.data.zhuan_tel) {
            globalData.showHint('转让人手机号不能为空');
            return
        }
        if (!this.data.zhuan_code) {
            globalData.showHint('验证码不能为空');
            return
        }
        let data = {
            captcha: this.data.zhuan_code,
            mobile: this.data.zhuan_tel,
            code: this.data.zhuan_num,
            ordernum: this.data.payMoneyData.trade_no,
        }
        globalData.sendPost('order/check-transfer', data).then(res => {
            if (res.status == 1) {

                this.setData({
                    step4_1: 2,
                    room: res.rid,
                    ['payMoneyData.trade_no']: res.ordernum,
                })
                let _this = this;
                wx.nextTick(function () {
                    _this.roomDtl();
                })
            } else {
                globalData.showHint(res.msg);
            }
        })
    },
    // 判断银行卡号
    bankinput(event) {
        let value = event.detail.value;
        
        this.setData({
            bank_card: value
        })
        let _this  =this;
            _this.setData({
                is_sendBank:true
            })
            wx.request({
                url: 'https://ccdcapi.alipay.com/validateAndCacheCardInfo.json', 
                data: {
                    cardNo: value,
                    cardBinCheck: 'true'
                },
                header: {
                    'content-type': 'application/json' // 默认值
                },
                success(res) {
                    if(res.data.bank){
                        _this.setData({
                            bank_name: banklist.dataList[res.data.bank]
                        })
                    }else{
                        globalData.showHint('银行卡号错误');
                    }
                },
                
            })
        
       
    }
})
